## Electoral competition by year
##BJPS R&R: Political Competition and Riots
## Author: RJT
## THis version 24 May 2015

library(foreign)
dat<-read.dta("/Users/risatoha/Documents/Political Competition/Revisions/Conditional Accept/replication trial/elcompyear.dta")
dim(dat)
summary(dat)

#Plot Parameters
colors <- rainbow(3)
yrange <- c(0,100)
xrange <- c(1990,2005)
par(mar=c(7.5, 4.1, 4.1, 4.1), xpd=TRUE)

#Plot
plot(xrange, yrange, type="n",xlab="Year", ylab="Percent", main="Electoral Competition in Indonesia")
lines(dat$year, dat$golkarvs, lty=1, col=colors[1], lwd=2)
lines(dat$year, dat$votmar, lty=2, col=colors[2],lwd=2)
lines(dat$year, dat$nongolkarvs, lty=4, col=colors[3], lwd=2)
legend(1988,-55, legend=c("Golkar Voteshare", "Vote Margins", "Non-Golkar Voteshare"),
    horiz=TRUE,cex=.75,col=c(colors[1],colors[2], colors[3]),lty=c(1,2,4), lwd=2, bty="n", text.width=c(4,4.5,4))

